//
//  TestView.m
//  ModuleA
//
//  Created by 胡林虎 on 2017/8/18.
//  Copyright © 2017年 胡林虎. All rights reserved.
//

#import "TestView.h"
#import "TestTableViewCell.h"
#import <ModuleB/HLShareManager.h>

@implementation TestView

-(void)setUIView {
    
    
    TestTableViewCell *cell = [HLShareManager loadCurretBundleResouceType:GFResXIBType currentClass:self bundleName:nil resourceName:@"TestTableViewCell"];
    
//    [[[NSBundle bundleForClass:[self class]] loadNibNamed:@"TestTableViewCell" owner:nil options:nil] firstObject];
    
    cell.frame = CGRectMake(0, 100, 100, 80);
    [self addSubview:cell];
    
    

//    UIImageView *imgV = [[UIImageView alloc] init];
//    imgV.frame = CGRectMake(0, 0, 100, 100);
//
//    imgV.image = [self FS_ImageNamed:@"HH"];
//    [self addSubview:imgV];
}
-(void)loadHtmlString:(NSString*)htmlString
{
    
    NSString *htmlcontent = [NSString stringWithFormat:
                             @"<html>"
                             "<head>"
                             "<meta charset='utf-8' name='viewport' content='width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no'/>"
                             "<style type=\"text/css\">"
                             "img {"
                             "max-width:100%%;"
                             "width:auto;"
                             "height:auto;"
                             "-webkit-tap-highlight-color:rgba(0,0,0,0);"
                             "}"
                             "</style>"
                             "<script type=\"text/javascript\">"
                             "</script>"
                             "</head>"
                             "<body>"
                             "<div>"
                             "<div id=\"webview_content_wrapper\">%@</div>"
                             "</div>"
                             "</body>"
                             "</html>"
                             ,htmlString];
//    [self.webView loadHTMLString:htmlcontent baseURL:nil];
}



-(id)loadCurretBundleResouceType:(GFResTypeStyles)ResTypeStyle
                     bundleClass:(NSObject *)object
                    resourceName:(NSString *)resName {
    id obj;
    NSBundle *bundle = [NSBundle bundleForClass:[object class]];
    if (ResTypeStyle == GFResXIBType) {
        obj =  [[bundle loadNibNamed:resName owner:nil options:nil] firstObject];
        
    }else if (ResTypeStyle == GFResImageType) {
        obj = [bundle pathForResource:resName ofType:nil];
        
    }else if (ResTypeStyle == GFResPlistType) {
        obj = [bundle pathForResource:resName ofType:nil];
        
    }
    return obj;
    
}


//-(UIImage *)FS_ImageNamed:(NSString *)imageName{
//    
//    static dispatch_once_t onceToken;
//    static NSBundle *resourceBundle;
//    
//    dispatch_once(&onceToken, ^{
//        
//        NSBundle *bundle = [NSBundle bundleForClass:[TestView class]];
//        NSURL *bundleURL = [bundle URLForResource:@"Source" withExtension:@"bundle"];
//        resourceBundle = [NSBundle bundleWithURL: bundleURL];
//    });
//    return resourceBundle?[UIImage imageNamed:imageName inBundle:resourceBundle compatibleWithTraitCollection:nil]:[UIImage imageNamed:imageName];
//}

@end
